package com.express.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.express.dto.ApiDto;
import com.express.entity.SysApiEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * api
 *
 * @author Rock.Zhou
 * @email cool_fish@aliyun.com
 * @date 2020-12-08 16:28:39
 */
@Repository
@Mapper
public interface SysApiDao extends BaseMapper<SysApiEntity> {

    /**
     * 根据用户获取所有api
     * @param userId
     * @return
     */
    @DS("api")
    List<SysApiEntity> selectListByUserId(@Param("userId") long userId);

    /**
     * api插入 返回apiId
     * @param apiEntity
     * @return
     */
    @DS("api")
    int insertOne(SysApiEntity apiEntity);

    /**
     * 同模块下查询接口名称是否存在
     * @param apiName
     * @param apiClassId
     * @return
     */
    List<SysApiEntity> selectListByApiName(@Param("apiName") String apiName,@Param("apiClassId") Long apiClassId);
}
